package com.zzzzzz.common.message;

public final class Message {
	
	private final MessageType type;
	
	private final String text;

	public Message(MessageType type, String text) {
		this.type = type;
		this.text = text;
	}

	public static Message success(String text) {
		return new Message(MessageType.SUCCESS, text);
	}
	public static Message success(String text, String icon) {
		return new Message(MessageType.SUCCESS, icon + text);
	}

	public static Message info(String text) {
		return new Message(MessageType.INFO, text);
	}

	public static Message warning(String text) {
		return new Message(MessageType.WARNING, text);
	}

	public static Message error(String text) {
		return new Message(MessageType.ERROR, text);
	}
	public static Message error(String text, String icon) {
		return new Message(MessageType.ERROR, icon + text);
	}

	public MessageType getType() {
		return type;
	}

	public String getText() {
		return text;
	}
	
	public String toString() {
		return type + ": " + text;
	}

}